package register

import java.util.Date;

import register.Owner;

class Pet implements Comparable {
    Owner owner
    String name
    String race
    String colour
    Date dateCreated = new Date()
    Date lastUpdated = new Date()
	
    static belongsTo = Owner
	
    static optionals = [ 'colour' ]

    static constraints = {
        name(size: 1..40, blank: false)
        race(size: 1..40, blank: false)
    }

    static mapping = {
        name type: 'text'
        owner index: 'pet_owner_index', unique: false
    }
    int compareTo(obj) {
        obj.id.compareTo(id)
    }
}
